package ssm框架整体流程实现.main.java.com.itheima.controller;

/**
 * 统一结果封装传回前端
 * result类一般定义在controller层，因为controller要用
 */
public class Result {
    //响应状态码，成功还是失败
    private Integer code;
    //返回的数据内容
    private Object data;
    //失败响应的信息
    private String msg;

    //构造方法一般给无参，
    // code和data的有参：表示成功
    //code +data +msg的有参：表示失败


    public Result() {
    }

    public Result(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Result(Integer code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
